import Vue from 'vue'
import VueRouter from 'vue-router'

import Home from '@v/home/Home'
import Movies from '@v/home/movies/Movies'
import InTheaters from '@v/home/movies/InTheaters'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    redirect: '/home'
  },
  {
    path: '/home',
    component: Home,
    redirect: '/home/movies',
    children: [
      {
        path: 'movies',
        component: Movies,
        redirect: '/home/movies/intheaters',
        children: [
          {
            path: 'intheaters',
            component: InTheaters,
            meta: {
              id: 0
            }
          },
          {
            path: 'comingsoon',
            component: () => import(/* webpackChunkName: "comingsoon" */ '@v/home/movies/ComingSoon'),
            meta: {
              id: 1
            }
          }
        ]
      },
      {
        path: 'theaters',
        component: () => import(/* webpackChunkName: "theaters" */ '@v/home/theaters/Theaters')
      },
      {
        path: 'profile',
        component: () => import(/* webpackChunkName: "profile" */ '@v/home/profile/Profile')
      }
    ]
  },
  {
    path: '/cities',
    component: () => import(/* webpackChunkName: "cities" */ '@v/cities/Cities.vue')
  },
  {
    path: '/details',
    component: () => import(/* webpackChunkName: "details" */ '@v/details/Details.vue')
  }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
